<template>
  <div
    class="coupon"
    v-if="ossUrl&&data"
    :style="{backgroundImage:'url('+(isTransSale?ossUrl+'/mp_3.2.4/coupon_y.png':ossUrl+'/mp_3.2.4/coupon.png')+')',padding:(isTransSale?4:0)+'px'}"
  >
    <div class="main">
      <div class="detail">
        <div class="name">
          <span class="tip" v-if="data.sign">[{{data.sign}}]</span>
          <span>{{data.name||""}}</span>
        </div>
        <div class="desc">{{data.desc||""}}</div>
        <div class="bottom">
          <div
            class="lf"
            v-if="data.start_time&&data.end_time"
          >{{data.start_time}}-{{data.end_time}}</div>
          <div class="rt" v-if="data.sale">已售：{{data.sale}}</div>
        </div>
      </div>
      <div class="box">
        <div class="boxmain">
          <div class="price">
            <span class="yang">¥</span>
            <span>{{data.price}}</span>
          </div>
          <div
            class="supply"
            v-if="data.min_sale_price&&data.goods_deduction_type!=0"
          >最低可至¥{{data.min_sale_price}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import common from "@/assets/js/mmk_common.js";
export default {
  props: {
    data: {
      //券数据
      type: Object,
      default: ""
    },
    isTransSale: {
      //是否是挂售/转让 默认不是
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      ossUrl: common.image_resource, //oss图片
      imgUrl: common.image_response //http图片
    };
  }
};
</script>

<style lang="less" scoped>
.coupon {
  min-height: 121px;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-sizing: border-box;
  .main {
    display: flex;
    height: 121px;
    .detail {
      width: 71%;
      padding: 14px 14px 10px;
      box-sizing: border-box;
      position: relative;
      .name {
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: rgba(51, 51, 51, 1);
        line-height: 18px;
        margin-bottom: 10px;
        .tip {
          color: rgba(255, 56, 62, 1);
          margin-right: 2px;
        }
      }
      .desc {
        font-size: 12px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        line-height: 17px;
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .bottom {
        width: 89%;
        font-size: 12px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        line-height: 17px;
        position: absolute;
        bottom: 10px;
        left: 14px;
        .lf {
          float: left;
          color: rgba(102, 102, 102, 1);
        }
        .rt {
          float: right;
        }
      }
    }
    .box {
      width: 29%;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .boxmain {
        text-align: center;
        .price {
          font-size: 21px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: rgba(255, 56, 62, 1);
          line-height: 18px;
          .yang {
            font-size: 14px;
          }
        }
        .supply {
          font-size: 12px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: rgba(255, 56, 62, 0.6);
          line-height: 17px;
          margin-top: 6px;
          white-space: nowrap;
        }
      }
    }
  }
}
</style>